import MySQL

import People
import Events
import TripExpenses
import SubGroupExpenses
import Payments

def GenerateTables(SQL=None):
    if SQL == None:
        SQL = MySQL.Connection()
    People.GenerateTables(SQL)
    Events.GenerateTables(SQL)
    TripExpenses.GenerateTables(SQL)
    SubGroupExpenses.GenerateTables(SQL)
    Payments.GenerateTables(SQL)
    
    PeopleTable = People.People(SQL)
    PeopleTable.AddPerson("Optimus", "Prime", "OP", Admin = 'True')
    Person = PeopleTable.GetPerson(f_name = "OPTIMUS")[0]
    Person.SetPassWord("autobots")
    PeopleTable.UpdatePerson(Person)
    print Person.Password
    
    Person = PeopleTable.GetPerson(f_name = "OPTIMUS")[0]
    print Person.CheckPassword("autobots")
    

if __name__ == '__main__':
    GenerateTables()